<link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<style>
    #billboy{
        font-size: 14px;
        margin-bottom: 20px;
        margin-left: 20px;
        margin-top: 20px;
        width: 760px;
    }
    #userdetail{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #packdetail{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #formto{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #billboy table td{
        border: 1px solid #CCCCCC;
    }
    #packdetail table td{
        border: 1px solid #CCCCCC;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 120px;
    }
    #cf{
        width: 230px;
    }
    
</style>
<script type="text/javascript">
    $(function(){
    
        $.datepicker.setDefaults( $.datepicker.regional[ "zh-CN" ] );
        $( "#packdetail #birthday" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>

<div id='billboy'>
    <form method="post" action="/admini/manageuser/editaddress/">
    <div id='userdetail'>
        用户信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>用户昵称：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->address->userinfo==null?"用户被删除":$this->address->userinfo->nikename;?></td>
              <td id='bf'>仓库号：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->address->userinfo==null?"用户被删除":$this->address->userinfo->storeno;?></td>
            </tr>
          </table>
    </div>
    <div id="packdetail">
        收件人地址信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>收件人：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="linkMan" id="linkMan" value="<?php echo $this->address->linkMan;?>" /></td>
              <td id='bf'>国家：</td><td id='cf'>&nbsp;&nbsp;<select id="state" name="state">
                      <?php foreach ($this->state as $value) { ?>
                        <option value="<?php echo $value->id;?>" <?php echo $value->id==$this->address->state?"selected":"";?> ><?php echo $value->name;?></option>
                      <?php } ?>
                  </select></td>
            </tr>
            <tr>
              <td id='bf'>街道：</td><td id='cf' colspan="3">&nbsp;&nbsp;
                  <textarea name="street" id="street" style=" width: 540px; height: 70px;margin-top: 10px;"><?php echo $this->address->street;?></textarea>
              </td>    
            </tr>
            <tr>
              <td id='bf'>手机：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="mobile" id="mobile" value="<?php echo $this->address->mobile;?>" size="30"/></td>
              <td id='bf'>电话：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="phone" id="phone" value="<?php echo $this->address->phone;?>" size="30"/></td>
            </tr>
            <tr>
              <td id='bf'>城市：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="city_name" id="city_name" value="<?php echo $this->address->city_name;?>" size="30"/></td>
              <td id='bf'>省/州或地区：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="province_name" id="province_name" value="<?php echo $this->address->province_name;?>" size="30"/></td>
            </tr>
            <tr>
              <td id='bf'>邮编：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="postcode" id="postcode" value="<?php echo $this->address->postcode;?>" size="30"/></td>
              <td id='bf' title="只有德国可能需要此信息">EORI(德国选填)：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="eori" id="eori" value="<?php echo $this->address->eori;?>" size="30"/></td>
            </tr>
            <tr>
                <td colspan="4" align="center"><input type="hidden" id="id" name="id" value="<?php echo $this->address->id;?>" />
                    <input type="hidden" id="operate" name="operate" value="editaddress" />
                    <input type='submit' name="submit" id="submit" value="确认提交" onclick="return ckform()" />&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;<input type='reset' name="reset" id="reset" value="重新填写" />&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" id="refo" naem="refo" value="返回" /></td>
            </tr>
        </table>
    </div>
    </form>
</div>
<?php
if($this->ma==2){
    echo '<script language="javascript" type="text/javascript">alert("发生未知错误，请重新操作！");location.href = "/admini/manageuser/address/";</script>';
}else if($this->ma==1){
     echo '<script language="javascript" type="text/javascript">alert("修改成功!");location.href = "/admini/manageuser/address/";</script>';
}
?>
<script language='javascript'>
    function ckform()
    {
        var linkMan = $('#linkMan').val();
        var street = $('#street').val();
        var mobile = $('#mobile').val();
        if(linkMan == ''){
            alert('收件人不能为空！');
            return false;
        }else if(street == ''){
            alert('收件人街道不能为空！');
            return false;
        }else if(mobile == ''){
            alert('收件人电话不能为空！');
            return false;
        }else{
            return true;
        }
    }
    $("#refo").click(function(){
       location.href = "/admini/manageuser/address/"; 
    });
</script>